package com.ruoyi.project.common.component;

import com.alibaba.fastjson.JSON;
/*import com.cl.unipay4j.core.Result;
import com.cl.unipay4j.core.transfer.ITransfer;
import com.cl.unipay4j.core.transfer.TransferToAccountModel;
import com.cl.unipay4j.wx.WxPayConfig;
import com.cl.unipay4j.wx.WxPayFactory;
import com.cl.unipay4j.wx.WxPayProperties;
import com.ruoyi.project.agent.utils.AgentUtil;*/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @ClassName WxTransferComponent
 * @Description
 * @Author Small
 * @Date 2020/9/7 11:33
 * @Version 1.0
 **/
@Component
public class WxTransferComponent {

   /* @Autowired
    private WxPayProperties wxPayProperties;

    *//**
     * 转账
     *
     * @param appid  appid
     * @return
     *//*
    public Result transfer(String appid, String openId, String outTradeNo, BigDecimal amount) {
        WxPayFactory wxPayFactory = new WxPayFactory();
        WxPayConfig payConfig = new WxPayConfig();
        payConfig.setAppid(appid);
        payConfig.setMchid(wxPayProperties.getConfig().getMchid());
        payConfig.setCertPath(wxPayProperties.getConfig().getCertPath());
        payConfig.setKey(wxPayProperties.getConfig().getKey());
        System.out.println("联盟商提现配置参数：" + JSON.toJSONString(payConfig));
        ITransfer transfer = wxPayFactory.getTransfer(payConfig);
        TransferToAccountModel model = new TransferToAccountModel();
        model.setIdentity(openId);
        model.setAmount(amount);
        model.setOutTradeNo(outTradeNo);
        model.setTitle("佣金提现");
        model.setRemark("佣金提现");
        System.out.println("联盟商提现参数：" + JSON.toJSONString(model));
        Result result = transfer.execTransferToAccount(model);
        return result;
    }*/
}
